<%@ page language="java" import="java.util.*" pageEncoding="Utf-8"%>
<%@page import="java.net.URLEncoder"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>登录</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/qdh.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/member.css" type="text/css" media="screen" />
<script src="${pageContext.request.contextPath}/common/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script>
$(function(){
	$("#name").focus();
})
	function loginFormSubmit() {
		var name=$("#name").val();
		var pwd=$("#pwd").val();
		var returnUrl=$("#returnUrl").val();
		if(returnUrl=="null"){returnUrl="../index.action"}
		$("#msg").html("");
		$.ajax({
			type: "post",
			url: "${pageContext.request.contextPath}/view/member/memberlogin.action",
			dataType:'json',
			data:"name="+name+"&pwd="+pwd,
			success:function(data){
				if(data.success){
					top.window.location.href="${pageContext.request.contextPath}/view/member/loginSuccess.action?returnUrl="+ escape(returnUrl);
				}else{
					if(data.msg==0)
					{
						$("#msg").html("请输入用户名和密码！");
					}
					if(data.msg==1)
					{
						$("#msg").html("该用户不存在！");
					}
					if(data.msg==2)
					{
						$("#msg").html("密码不正确！");
					}
					if(data.msg==3)
					{
						$("#msg").html("账号被禁用！");
					}
				}
			}
		});
		return false;
	}

</script>
</head>
<body>
<div id="wrap">

<s:include value="header.jsp"/>
	<div id="container">
		<div class="memberbox">
			<h1>用户登录</h1>
			<div class="fl loginbox">
				<div class="logintips"><span id="msg">请先登录</span></div>
				<form onsubmit="return loginFormSubmit();">
				<ul class="loginform">
				<input type="hidden"  id="returnUrl" value="<%=request.getParameter("returnUrl")%>">
					<li><span>用户名</span><input type="text" id="name" class="logintxt" /></li>
					<li><span>密&nbsp;&nbsp;&nbsp;码</span><input type="password" id="pwd" class="logintxt" /></li>
					<li><span>&nbsp;</span><input type="submit" class="loginbtn" value=""/></li>				
				</ul>
				</form>
			</div>
			<div class="fr reginfo">
				<h2>现在还不是网站会员？</h2>
				<p><a href="${pageContext.request.contextPath}/view/member/reg.jsp" title="注册新用户"><img src="${pageContext.request.contextPath}/common/image/regbtn.jpg" alt="注册新用户"/></a></p>
			</div>
		</div>
		<div class="clr"></div>
	</div>
    <div class="mt15"></div>
	<s:include value="../footer.htm"></s:include>
</div>
</body>
</html>